var http = require('http');
var url = require('url');
var queryString = require('querystring');
// http.createServer(function(req, res){
//     res.write('hello http');
//
//     res.end('this is running on http://127.0.0.1:8080');
// }).listen(8080);
// console.log('this is running on http://127.0.0.1:8080');
var server = new http.Server();
server.listen(8080);
// 当有请求执行
server.on("request", function (req, res) {
    // 设置响应头
    res.writeHead(200, {
        "Content-Type": "text/html;charset=utf-8"
    });
    // 处理请求数据
    var reqString = queryString.parse((url.parse(req.url)).query).content;
    res.write('data is '+ reqString);
    res.end();
});
console.log('this is running on http://127.0.0.1:8080');
